--TEST--
Formatter callback in context
--FILE--
<?php
/**
 * Test file to test formatter specification in context
 *
 * PHP version 5
 *
 * @category  Stream
 * @package   Stream_Iterate
 * @author    Philippe Jausions <Philippe.Jausions@11abacus.com>
 * @copyright 2008 by 11abacus / Philippe Jausions
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @link      http://pear.11abacus.com/package/Stream_Iterate
 */

/**
 * Required package to test
 */
require_once 'Stream/Iterate.php';
require_once 'formatter.inc';

/**
 * Main
 */

// Register protocol
stream_wrapper_register('foreach', 'Stream_Iterate');

$data = array('letters' => 'abc', 'numbers' => 123);

// Create the context for the stream
$context = stream_context_create(array('foreach' => array(
                                    'subject'  => &$data,
									'formatter' => 'MyTestFormat')));
// Open the stream
$fp = fopen('foreach://subject', 'r', false, $context);

set_time_limit(1);
if (!$fp) {
    echo 'Could not open path';
    return;
}
while (!feof($fp)) {
    echo fgets($fp);
}
fclose($fp);

?>
--EXPECT--
First Iteration
0) KEY: letters; VALUE: abc
1) KEY: numbers; VALUE: 123
Last Iteration: #1